package com.hspedu.spring.factory;

import com.hspedu.spring.bean.Monster;

import java.util.HashMap;
import java.util.Map;

/**
 * @author Charlie
 * @version 1.0
 * @date 1/11/2025 下午8:37
 */
public class MyInstanceFactory {
    private static Map<String, Monster> monsterMap;

   {
        monsterMap =new HashMap<>();
        monsterMap.put("monster01",new Monster("niu",100,"芭蕉扇"));
        monsterMap.put("monster02",new Monster("niu2",101,"芭蕉扇~"));

    }

    public Monster getMonster(String key ) {
        return monsterMap.get(key);

    }
}
